package cn.lg.soar.redis.manager;

import cn.lg.soar.core.manager.SoarLock;
import org.redisson.api.RLock;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;

public class RedisSoarLock implements SoarLock {

    private final RLock lock;

    public RedisSoarLock(RLock lock) {
        this.lock = lock;
    }

    @Override
    public String getName() {
        return lock.getName();
    }

    @Override
    public void lockInterruptibly(long var1, TimeUnit var3) throws InterruptedException {
        lock.lockInterruptibly(var1, var3);
    }

    @Override
    public boolean tryLock(long var1, long var3, TimeUnit var5) throws InterruptedException {
        return lock.tryLock(var1, var3, var5);
    }

    @Override
    public void lock(long var1, TimeUnit var3) {
        lock.lock(var1, var3);
    }

    @Override
    public boolean forceUnlock() {
        return lock.forceUnlock();
    }

    @Override
    public boolean isLocked() {
        return lock.isLocked();
    }

    @Override
    public boolean isHeldByThread(long var1) {
        return lock.isHeldByThread(var1);
    }

    @Override
    public boolean isHeldByCurrentThread() {
        return lock.isHeldByCurrentThread();
    }

    @Override
    public int getHoldCount() {
        return lock.getHoldCount();
    }

    @Override
    public long remainTimeToLive() {
        return lock.remainTimeToLive();
    }

    @Override
    public void lock() {
        lock.lock();
    }

    @Override
    public void lockInterruptibly() throws InterruptedException {
        lock.lockInterruptibly();
    }

    @Override
    public boolean tryLock() {
        return lock.tryLock();
    }

    @Override
    public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
        return lock.tryLock(time, unit);
    }

    @Override
    public void unlock() {
        lock.unlock();
    }

    @Override
    public Condition newCondition() {
        return lock.newCondition();
    }

}
